package com.googlecode.sqldatagenerator.util;

public class StringUtil {

    private StringUtil(){
    }
    
    public static boolean equals(CharSequence a, CharSequence b){
        if (a == b){
            return true;
        }
        if (a == null || b == null){
            return false;
        }
        int len = a.length();
        if (len == b.length()){
            for (int i=0; i<len; i++){
                if (a.charAt(i) != b.charAt(i)){
                    return false;                    
                }
            }
            return true;
        }
        return false;
    }

    public static boolean equalsIgnoreCase(CharSequence a, CharSequence b){
        if (a == b){
            return true;
        }
        if (a == null || b == null){
            return false;
        }
        int len = a.length();
        if (len == b.length()){
            for (int i=0; i<len; i++){
                if (Character.toUpperCase(a.charAt(i)) != Character.toUpperCase(b.charAt(i))){
                    return false;                    
                }
            }
            return true;
        }
        return false;
    }
}
